//
//  UILabel+LCBCreate.m
//  ComeSave
//
//  Created by admin on 16/6/17.
//  Copyright © 2016年 admin. All rights reserved.
//

#import "UILabel+LLAdd.h"

@implementation UILabel (LLAdd)

// 适配XIB中的字体
- (void)setFixWidthScreenFont:(float)fixWidthScreenFont
{
    if (fixWidthScreenFont > 0) {
        self.font = [UIFont systemFontOfSize:fixWidthScreenFont];
    } else {
        self.font = self.font;
    }
    
}

- (float)fixWidthScreenFont
{
    return self.fixWidthScreenFont;
}

+ (instancetype)labelWithTitle:(NSString *)title color:(UIColor *)color fontSize:(CGFloat)fontSize {
    return [self labelWithTitle:title color:color fontSize:fontSize alignment:NSTextAlignmentLeft];
}

+ (instancetype)labelWithTitle:(NSString *)title color:(UIColor *)color fontSize:(CGFloat)fontSize alignment:(NSTextAlignment)alignment {
    
    UILabel *label = [[UILabel alloc] init];
    
    label.text = title;
    label.textColor = color;
    label.font = [UIFont systemFontOfSize:fontSize];
    label.textAlignment = alignment;
    
    return label;
}

+ (instancetype)labelWithTitle:(NSString *)title color:(UIColor *)color font:(UIFont *)font {
    return [self labelWithTitle:title color:color font:font alignment:NSTextAlignmentLeft];
}

+ (instancetype)labelWithTitle:(NSString *)title font:(UIFont *)font
{
    return [self labelWithTitle:title color:[UIColor blackColor] font:font];
}


+ (instancetype)labelWithBorderTitle:(NSString *)title font:(UIFont *)font
{
    UILabel *label = [self labelWithTitle:title color:[UIColor blackColor] font:font alignment:NSTextAlignmentCenter];
    label.layer.borderColor = [UIColor blackColor].CGColor;
    label.layer.borderWidth = 1;
    return label;
}

+ (instancetype)labelWithTitle:(NSString *)title color:(UIColor *)color font:(UIFont *)font alignment:(NSTextAlignment)alignment {
    
    UILabel *label = [[UILabel alloc] init];
    label.text = title;
    label.textColor = color;
    label.font = font;
    label.textAlignment = alignment;
    return label;
}

+ (instancetype)labelTextCenterWithTitle:(NSString *)title color:(UIColor *)color fontSize:(CGFloat)fontSize
{
    return [self labelWithTitle:title color:color fontSize:fontSize alignment:NSTextAlignmentCenter];
}

@end
